package cn.ccew.common.base.model;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * @类功能说明：
 * @类修改者：
 * @修改日期：
 * @修改说明：
 * @公司：春城1网
 * @作者：李兴建
 * @创建时间：2013-9-29 上午11:12:08
 * @版本：V1.0
 */
@MappedSuperclass
public class BaseEntity {
	/**
	 * 主键 生成格式 "20130930173732FCY9FB" 子类不允许重写
	 */
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "cn.ccew.common.utils.AssignedSequenceGenerator", parameters = { @Parameter(name = "sequence", value = "seq_payablemoney") })
	private java.lang.String id;
	/**
	 * 对象创建时间
	 */
	private Timestamp createTime;
	@Transient
	private Timestamp createTimeString;
	/**
	 * 对象修改时间
	 */
	private Timestamp lastModifyTime;
	@Transient
	private String lastModifyTimeString;
	/**
	 * 对象排序标识
	 */
	private int priority;
	/**
	 * 对象状态
	 */
	private int status;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public void setCreateTimeString(Timestamp createTimeString) {
		this.createTimeString = createTimeString;
	}

	public void setLastModifyTime(Timestamp lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	
	public Timestamp getLastModifyTime() {
		return lastModifyTime;
	}

	public String getCreateTimeString() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		if (null == createTime) {
			return "";
		}
		return sdf.format(createTime);
	}

	public String getCreateTimeStringYYYYMMdd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		if (null == createTime) {
			return "";
		}
		return sdf.format(createTime);
	}

	public String getLastModifyTimeString() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		if (null == lastModifyTime) {
			return "";
		}
		return sdf.format(lastModifyTime);
	}

	public String getLastModifyTimeStringYYYYMMdd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		if (null == lastModifyTime) {
			return "";
		}
		return sdf.format(lastModifyTime);
	}

	public void setLastModifyTimeString(String lastModifyTimeString) {
		this.lastModifyTimeString = lastModifyTimeString;
	}

}
